package com.dragon.repository.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dragon.repository.entity.Equipment;
import com.dragon.repository.entity.OtherFile;
import com.dragon.repository.entity.ProduceProducts;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ProduceProductsDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "供应商产品报价id")
    private Integer quotesProductId;

    @ApiModelProperty(value = "生产id")
    private Integer produceId;

    @ApiModelProperty(value = "合同数量")
    private Integer num;

    @ApiModelProperty(value = "生产数量")
    private Integer produceNum;

    @ApiModelProperty(value = "发货数量")
    private Integer deliverNum;

    @ApiModelProperty(value = "剩余数量")
    private Integer inventoryNum;

    @ApiModelProperty(value = "退货数量")
    private Integer rejectedNum;

    @ApiModelProperty(value = "排产完成数量")
    private Integer scheduledNum;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "生产状态：0未生产1生产中2生产完成")
    private Integer produceStatus;

    @ApiModelProperty(value = "单位名称")
    private String unitName;

    @ApiModelProperty(value = "产品名称")
    private String name;

    @ApiModelProperty(value = "规格类型")
    private String specification;

    @ApiModelProperty(value = "材质")
    private String  vProductMaterial;

    @ApiModelProperty(value = "备注")
    private String  vProductRemark;

    @ApiModelProperty(value = "排产状态：0 未排产 1正在排产 2排产完成")
    private Integer schedulingStatus;

    @ApiModelProperty(value = "附件")
    private List<OtherFile> otherFileList;

    @ApiModelProperty(value = "生产设备")
    private String equipmentCode;

    @ApiModelProperty(value = "是否外发 0否 1是")
    private Integer isOut;



    public ProduceProductsDTO() {}

    public ProduceProductsDTO(ProduceProducts entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ProduceProductsDTO convert(ProduceProducts entity) {
        return new ProduceProductsDTO(entity);
    }

    public static List<ProduceProductsDTO> convertList(List<ProduceProducts> list) {
        List<ProduceProductsDTO> resultList = new ArrayList<>();
        for (ProduceProducts entity : list) {
            resultList.add(new ProduceProductsDTO(entity));
        }
        return resultList;
    }}
